﻿@model IEnumerable<WebVideo.EntityVideo>
@{
    ViewBag.Title = "Video Adv- Tất cả video";
   
}
<div class="inner-container" id="inner-container" style="width:8000px">
	 <div class="wrap-widget" id="ads">
        
			<div class="inner-widget _8">
				 <h1>Xem quảng cáo</h1>
                 <div class="pagination pagination-right">
                        <ul>
                            @{
                                for (var i = 0; i <= ViewBag.sl / 21; i++)
                                {
                                    var t = i + 1;
                                    if (t == 1)
                                    {
                                        <li class="active"  id ="@t"><a  href="#" onclick ="PhanTrang('@t')">@t</a></li>
                                    }
                                    else
                                    {
                                        <li  id ="@t"><a  href="#" onclick ="PhanTrang('@t')">@t</a></li>
                                    }

                                }
                            }
                      
                        </ul>
                 
                    </div><!--/ .pagination-->
                <div  id ="AllVideo">
@{ 
    if (@Model.Count() != 0)
    {
        if (System.Web.HttpContext.Current.Request.Cookies["userId"] != null)
        {
            int i = 0;
            foreach (var item in Model)
            {
                string imgct = "~/Content/Images/Avatar/" + item.EntityBusiness.Avatar;
                string imgvs = "~/Content/Images/Video/" + item.Image;
                if (i == 0)
                { 
							<div class="widget _2x2" style="overflow:hidden;">
							
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="305" height="305"/>
									</a>                    
							   <div class="description"> 
										<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>      
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
                }
                else
                {
							<div class="widget" style="overflow:hidden;">
				   
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="304" height="147"/>
									</a>   

						   
								<div class="description">
									<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
                }

                i++;
            }

        }
        else if (System.Web.HttpContext.Current.Request.Cookies["userId"] == null)
        {
            int i = 0;
            foreach (var item in Model)
            {
                string imgct = "~/Content/Images/Avatar/" + item.EntityBusiness.Avatar;
                string imgvs = "~/Content/Images/Video/" + item.Image;
                if (i == 0)
                { 
							<div class="widget _2x2" id ="widget1" style="overflow:hidden;">
							
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="305" height="305"/>
									</a>                    
							   <div class="description"> 
										<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>      
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
                }
                else
                {
							<div class="widget" id ="widget2" style="overflow:hidden;">
				   
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="304" height="147"/>
									</a>   

						   
								<div class="description">
									<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
                }

                i++;
            }
							  
        }

    }
    else
    {
                    <div class="widget _3x1 phone bg-color-ForestGreen">
                    	<div class="widgetMsg">
                            <div class="pull-left"><img src="@Url.Content("~/Content/cssFrontEnd/images/icon-msg-success.png")" /></div>
                            <p>Chúc mừng bạn. <br />
                          Bạn đã xem hết video trong ngày hôm nay!</p>
                        </div>
                    </div><!--/ .widget-->
    }
 }
                </div>
        </div><!--/ .inner-widget-->
	</div><!--/ .wrap-widget -->
</div><!--/ .inner-container-->
@section occasionalScripts {
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/jquery.min.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/load.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/styles.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/jquery.nicescroll.min.js")" ></script>

}
<script type="text/javascript">
    document.body.className = 'no-js'
    function PhanTrang(Id) {

        var getURL = '@Url.Action("_AllVideo", "Index")';
        var idl = Id - 1;
        $('li').removeClass('active');
        $('li#' + Id + '').addClass('active');
        $.get(getURL, { "page": Id }, function (data) {
            $("div#AllVideo").html(data);

        });
    }
    $(document).ready(function () {
        $('#widget1,#widget2,#widget3').click(function (e) {
            e.preventDefault();
            $('#frmLoginn, #widget _2x1').modal('show');
        });
    });
</script>